#include "uiaction.h"
#include "imagebutton.h"
#include "textbutton.h"

void executeThisAction(void * a_action)
{
	((Action*)a_action)->execute();
}

Button * UIAction::createButton()
{
	Button * b;
	if(getIcon())
	{
		b = new ImageButton();
		((ImageButton*)b)->setButtonImage(*getIcon());
	}
	else
	{
		b = new TextButton();
		((TextButton*)b)->setText(getText());
	}
	b->setAction(executeThisAction, this);
	return b;
}
